Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC-557] add example for triggering job with GraphQL endpoint #25288

Merged
merged 4 commits into from
Oct 18, 2024

Conversation

cmpadden
Copy link
Contributor

@cmpadden cmpadden commented Oct 15, 2024

Summary & Motivation

  • Explains how to trigger a run using the LaunchRunMutation with the GraphQL endpoint

How I Tested These Changes

Created a local Dagster instance containing:

import dagster as dg


@dg.job
def example_job():
    print('Hello, world')

defs = dg.Definitions(
    jobs=[example_job]
)

Launched the run using:

response = requests.post(
    graphql_endpoint,
    json={
        "query": query,
        "variables": {
            "repositoryLocationName": "graphql-example-dagster.py",
            "repositoryName": "__repository__",  # default if using `Definitions`
            "jobName": "example_job",
            "runConfigData": {},
        },
    },
)

The same was done for the asset materialization.

response = requests.post(
    graphql_endpoint,
    json={
        "query": query,
        "variables": {
            "executionParams": {
                "mode": "default",
                "runConfigData": "{}",
                "selector": {
                    "assetCheckSelection": [],
                    "assetSelection": [{"path": ["example_asset"]}],
                    "pipelineName": "__ASSET_JOB",
                    "repositoryLocationName": "graphql-example-dagster.py",
                    "repositoryName": "__repository__",
                },
            }
        },
    },
)

Changelog

Insert changelog entry or delete this section.

@graphite-app graphite-app bot added the area: docs Related to documentation in general label Oct 15, 2024
@cmpadden cmpadden requested a review from slopp October 15, 2024 20:11
Copy link

github-actions bot commented Oct 15, 2024

)
```

### Triggering an asset materialization
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added both asset materialization via LaunchPipelineExecution and run request with LaunchRunMutation.

How do we feel about the presentation of these two options?

@cmpadden cmpadden requested a review from yuhan October 16, 2024 16:58
Copy link
Contributor

@slopp slopp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to stamp this because I want us to be able to merge it and move forward.

One minor nit that can be done in this PR or a follow up, could we add a breadcrumb from the sensors page (https://dagster-docs-beta-7hhekcwb3-elementl.vercel.app/guides/sensors) to this?

The sensors page is listed as 'event-triggers' in the sidebar, so I think someone might naturally click there. We want them to read about sensors but also know there are other options.

One suggestion for language is to update that page with:

Creating event-based pipelines with sensors

Sensors enable you to trigger Dagster runs in response to events from external systems.
They run at regular intervals, either triggering a run or explaining why a run was skipped. For example, you can trigger a run when a new file is added to an Amazon S3 bucket or when a database row is updated.

:::tip
An alternative to polling with sensors is to push events to Dagster using the Dagster API

@cmpadden
Copy link
Contributor Author

I'm going to stamp this because I want us to be able to merge it and move forward.

One minor nit that can be done in this PR or a follow up, could we add a breadcrumb from the sensors page (https://dagster-docs-beta-7hhekcwb3-elementl.vercel.app/guides/sensors) to this?

The sensors page is listed as 'event-triggers' in the sidebar, so I think someone might naturally click there. We want them to read about sensors but also know there are other options.

One suggestion for language is to update that page with:

Creating event-based pipelines with sensors

Sensors enable you to trigger Dagster runs in response to events from external systems. They run at regular intervals, either triggering a run or explaining why a run was skipped. For example, you can trigger a run when a new file is added to an Amazon S3 bucket or when a database row is updated.

:::tip An alternative to polling with sensors is to push events to Dagster using the Dagster API

Thanks! Added your suggestion to this PR.

image

@cmpadden cmpadden merged commit 79d60bf into master Oct 18, 2024
2 of 3 checks passed
@cmpadden cmpadden deleted the colton/graphql-automation branch October 18, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Related to documentation in general
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants